package com.xtedu.examproject.service;

import com.xtedu.examproject.dao.base.ExaminationPaperDao;
import com.xtedu.examproject.dao.impl.ExaminationPaperDaoImpl;
import com.xtedu.examproject.entity.ExaminationPaper;

import java.sql.SQLException;
import java.util.List;

public class ExaminationPaperService {
    private ExaminationPaperDao examinationPaperDao;

    public ExaminationPaperService(){
        examinationPaperDao = new ExaminationPaperDaoImpl();
    }

    public int insertExaminationPaper(ExaminationPaper examinationPaper) throws Exception {
        return examinationPaperDao.insert(examinationPaper);
    }

    public int deleteExaminationPaper(ExaminationPaper examinationPaper) throws Exception {
        return examinationPaperDao.delete(examinationPaper);
    }

    public int updateExaminationPaper(ExaminationPaper examinationPaper) throws Exception {
        return examinationPaperDao.update(examinationPaper);
    }

    public ExaminationPaper findExaminationPaperById(ExaminationPaper examinationPaper) throws Exception {
        return examinationPaperDao.findById(examinationPaper.getId());
    }

    public List<ExaminationPaper> findAllExaminationPaper() throws Exception {
        return examinationPaperDao.findAll();
    }
}
